import {
  Column,
  CreateDateColumn,
  Entity,
  JoinTable,
  ManyToMany,
  ManyToOne,
  OneToOne,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';
import { Enterprise } from './enterprise.entity';

@Entity({ name: 'trademarks' })
export class Trademark {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    length: 255,
    comment: '商标名称',
  })
  name: string;

  @Column({
    type: 'timestamp',
    comment: '申请日期',
  })
  applicationDate: Date;

  @Column({
    type: 'timestamp',
    comment: '注册日期',
  })
  registrationDate: Date;

  @Column({
    length: 255,
    comment: '申请人',
  })
  applicant: string;

  @CreateDateColumn({
    type: 'timestamp',
    comment: '创建时间',
  })
  createTime: Date;

  @UpdateDateColumn({
    type: 'timestamp',
    comment: '更新时间',
  })
  updateTime: Date;

  @ManyToOne(() => Enterprise, (enterprise) => enterprise.patents, {
    onDelete: 'CASCADE',
    onUpdate: 'CASCADE',
  })
  enterprise: Enterprise;
}
